package net.adetech.crj.entity;

import java.io.Serializable;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;

public class Announcement implements Serializable {
    private long id;
    private String title;
    private String author;
    private String content;
    private Timestamp createDate;
    private String announcementType;
    private String status;
    private String remark;

    public String getCreateDateString()
    {
        String result = "";
        try {
            result = new SimpleDateFormat("yyyy.MM.dd").format(this.createDate);
        }catch (Exception e)
        {
            e.printStackTrace();
        }
        return result;
    }

    public String getCreateDateString2()
    {
        String result = "";
        try {
            result = new SimpleDateFormat("yyyy-MM-dd").format(this.createDate);
        }catch (Exception e)
        {
            e.printStackTrace();
        }
        return result;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Timestamp getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Timestamp createDate) {
        this.createDate = createDate;
    }

    public String getAnnouncementType() {
        return announcementType;
    }

    public void setAnnouncementType(String announcementType) {
        this.announcementType = announcementType;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getContentHtml()
    {
        if (this.content!=null)
        {
            String result =  "<p>" + this.content.replaceAll(" ","&nbsp;").replaceAll("(\r\n|\r|\n)","</p><p>") +"</p>";
            return result;
        }

        return this.content;
    }
}
